﻿using System;
using System.Collections.Generic;

namespace OConf.Model.RequestInput.ProjectInfo
{
    public class ProjectInfoModel
    {
        /// <summary>
        /// 项目编号
        /// </summary>
        public string ID { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }
        /// <summary>
        /// 项目描述
        /// </summary>
        public string ProjectDescription { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
    }

    /// <summary>
    /// 项目详情-包含的配置信息
    /// </summary>
    public class ProjectConfigs
    {
        /// <summary>
        /// 项目编号
        /// </summary>
        public string ProjectID { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 项目描述
        /// </summary>
        public string ProjectDescription { get; set; }

        /// <summary>
        /// 是否保护
        /// </summary>
        public bool IsProtect { get; set; }

        /// <summary>
        /// 秘钥
        /// </summary>
        public string SecretKey { get; set; }
    }

    #region 客户端获取配置信息模型
    /// <summary>
    /// 后台系统获取配置信息请求参数
    /// </summary>
    public class BackProgramGetConfigInfoInput
    {
        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProgramName { get; set; }

        /// <summary>
        /// 要加载的命名空间
        /// </summary>
        public List<string> NameSpaces { get; set; }
    }

    /// <summary>
    /// 客户端获取配置信息模型
    /// </summary>
    public class BackProgramConfigInfo
    {
        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 项目最近发布时间
        /// </summary>
        public long LastPublishTime { get; set; }

        public List<BackCNameSpaceModel> NameSpaces { get; set; } = new List<BackCNameSpaceModel>();
    }

    public class BackCNameSpaceModel
    {
        /// <summary>
        /// 命名空间名称
        /// </summary>
        public string NameSpace { get; set; }

        /// <summary>
        /// 配置信息
        /// </summary>
        public List<ConfigInfo> ConfigInfos { get; set; }
    }

    public class ConfigInfo
    {
        public string Key { get; set; }
        public string Value { get; set; }
    }

    /// <summary>
    /// 检查配置信息版本请求参数
    /// </summary>
    public class CheckConfigInfoInput
    {
        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProgramName { get; set; }

        /// <summary>
        /// 项目最后一次发布时间
        /// </summary>
        public long LastPublishTime { get; set; }

        /// <summary>
        /// 订阅的命名空间
        /// </summary>
        public List<string> NameSpaces { get; set; }
    }
    #endregion
}
